package thread;

import java.util.stream.IntStream;

public class ThreadYield {

    public static void main(String[] args) {
        IntStream.range(0, 10000).mapToObj(ThreadYield::create).
                forEach(Thread::start);
    }

    private static Thread create(int index) {
        return new Thread(()->{
//            if (index == 2)
//                Thread.yield();

           System.out.println(index);
        });
    }
}
